package com.subsequent.controller;

import com.subsequent.pojo.DoctorServices;
import com.subsequent.service.DoctorServicesService;
import com.subsequent.vo.DoctorServiceVO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@RestController
@RequestMapping("/doctorServices")
public class DoctorServiceController {

    @Autowired
    private DoctorServicesService doctorServiceService;

    @GetMapping("/list")
    public List<DoctorServiceVO> listAll() {
        return doctorServiceService.listAll();
    }

    @GetMapping("/{id}")
    public DoctorServiceVO getById(@PathVariable Integer id) {
        return doctorServiceService.getById(id);
    }

    @PostMapping("/add")
    public void add(@RequestBody DoctorServices doctorService) {
        doctorServiceService.add(doctorService);
    }

    @PutMapping("/update")
    public void update(@RequestBody DoctorServices doctorService) {
        doctorServiceService.update(doctorService);
    }

    @DeleteMapping("/delete/{id}")
    public void delete(@PathVariable Integer id) {
        doctorServiceService.delete(id);
    }
}